package com.ruoyi.ams.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.ams.domain.AmsAssetAllocation;
import com.ruoyi.ams.mapper.AmsAssetAllocationMapper;
import com.ruoyi.ams.service.IAmsAssetAllocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 资产调拨Service业务层处理
 * 
 * @author yfkj
 * @date 2022-05-16
 */
@Service
public class AmsAssetAllocationServiceImpl extends ServiceImpl<AmsAssetAllocationMapper, AmsAssetAllocation>  implements IAmsAssetAllocationService
{
    @Autowired
    private AmsAssetAllocationMapper amsAssetAllocationMapper;

    /**
     * 查询资产调拨
     * 
     * @param allocationId 资产调拨主键
     * @return 资产调拨
     */
    @Override
    public AmsAssetAllocation selectAmsAssetAllocationByAllocationId(Long allocationId)
    {
        return amsAssetAllocationMapper.selectAmsAssetAllocationByAllocationId(allocationId);
    }

    /**
     * 查询资产调拨列表
     * 
     * @param amsAssetAllocation 资产调拨
     * @return 资产调拨
     */
    @Override
    public List<AmsAssetAllocation> selectAmsAssetAllocationList(AmsAssetAllocation amsAssetAllocation)
    {
        return amsAssetAllocationMapper.selectAmsAssetAllocationList(amsAssetAllocation);
    }

    /**
     * 新增资产调拨
     * 
     * @param amsAssetAllocation 资产调拨
     * @return 结果
     */
    @Override
    public int insertAmsAssetAllocation(AmsAssetAllocation amsAssetAllocation)
    {
        amsAssetAllocation.setCreateTime(System.currentTimeMillis());
//        amsAssetAllocation.setCreateBy(SecurityUtils.getUsername());
        return amsAssetAllocationMapper.insertAmsAssetAllocation(amsAssetAllocation);
    }

    /**
     * 修改资产调拨
     * 
     * @param amsAssetAllocation 资产调拨
     * @return 结果
     */
    @Override
    public int updateAmsAssetAllocation(AmsAssetAllocation amsAssetAllocation)
    {
        amsAssetAllocation.setUpdateTime(System.currentTimeMillis());
//        amsAssetAllocation.setUpdateBy(SecurityUtils.getUsername());

        return amsAssetAllocationMapper.updateAmsAssetAllocation(amsAssetAllocation);
    }

    /**
     * 批量删除资产调拨
     * 
     * @param allocationIds 需要删除的资产调拨主键
     * @return 结果
     */
    @Override
    public int deleteAmsAssetAllocationByAllocationIds(Long[] allocationIds)
    {
        return amsAssetAllocationMapper.deleteAmsAssetAllocationByAllocationIds(allocationIds);
    }

    /**
     * 删除资产调拨信息
     * 
     * @param allocationId 资产调拨主键
     * @return 结果
     */
    @Override
    public int deleteAmsAssetAllocationByAllocationId(Long allocationId)
    {
        return amsAssetAllocationMapper.deleteAmsAssetAllocationByAllocationId(allocationId);
    }
}
